<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Whisper: ip_packet.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Whisper
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">ip_packet.h</div>  </div>
</div>
<div class="contents">
<a href="ip__packet_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __IP_PACKET_H__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __IP_PACKET_H__ 1</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="comment">/* START libnet work-around */</span>
<a name="l00007"></a>00007 <span class="comment">/* _GNU_SOURCE is redefined in libnet.h, the following three lines are</span>
<a name="l00008"></a>00008 <span class="comment"> * suppressed </span>
<a name="l00009"></a>00009 <span class="comment"> */</span> 
<a name="l00010"></a>00010 <span class="preprocessor">#ifdef _GNU_SOURCE</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#undef _GNU_SOURCE</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="comment">/* END libnet work-around */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;libnet.h&gt;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="comment">/* define the following to memcpy(3) the packet buffer */</span>
<a name="l00018"></a>00018 <span class="preprocessor">#undef MEMCPY </span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a><a class="code" href="classCIPPacket.html">00020</a> <span class="keyword">class </span><a class="code" href="classCIPPacket.html">CIPPacket</a>
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022         <span class="keyword">public</span>:
<a name="l00023"></a>00023                 <span class="keyword">virtual</span> <a class="code" href="classCIPPacket.html#aa4cd221d8c49ee56b6b15f4487785e20">~CIPPacket</a>();
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="classCIPPacket.html#a563961792e7cb75e5fbf81cac03e13ab">00025</a>                 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classCIPPacket.html#a563961792e7cb75e5fbf81cac03e13ab">sMaxPacketLength</a>;
<a name="l00026"></a>00026 
<a name="l00027"></a>00027                 <span class="keyword">static</span> <a class="code" href="classCIPPacket.html">CIPPacket</a>* <a class="code" href="classCIPPacket.html#a2892aa9ff83c1350bc0d3b5a147398e7">createIPPacket</a>(uint8_t* pForeignPacketBuffer, <span class="keywordtype">int</span> pBufferLength);
<a name="l00028"></a>00028                 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classCIPPacket.html#aba77b10e1a6131ef8b468d528cf4e84a">destroyIPPacket</a>(<a class="code" href="classCIPPacket.html">CIPPacket</a>* pIPPacket);
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="classCIPPacket.html#aaac29ac55a26af5e36a29ec59475b862">00030</a>                 <span class="keyword">virtual</span> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classCIPPacket.html#aaac29ac55a26af5e36a29ec59475b862">getPacketLength</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classCIPPacket.html#a0eb3e5f6044bf53ea84a79aa878b2af7">mBufferLength</a>; }
<a name="l00031"></a>00031 
<a name="l00032"></a>00032                 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classCIPPacket.html#aeafec251c4544f5e7202d2909f6efd4b">isUDP</a>() <span class="keyword">const</span>;
<a name="l00033"></a>00033                 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classCIPPacket.html#aa01d239373825bbb64dac28759ca9725">isTCP</a>() <span class="keyword">const</span>;
<a name="l00034"></a>00034                 <span class="keyword">virtual</span> uint32_t <a class="code" href="classCIPPacket.html#a0577fe8bbad8d642f3b1988d1edc6bab">getSrcIP</a>() <span class="keyword">const</span>;
<a name="l00035"></a>00035                 <span class="keyword">virtual</span> uint32_t <a class="code" href="classCIPPacket.html#afe8f049a6ffc3841a8b3b789d8f07d07">getDstIP</a>() <span class="keyword">const</span>;
<a name="l00036"></a>00036                 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classCIPPacket.html#a823ab474c2b8024f0c0443611fb00b0a">getSrcPort</a>() <span class="keyword">const</span>;
<a name="l00037"></a>00037                 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classCIPPacket.html#aa495d74a870bbc7eebfae2ec28525fd2">getDstPort</a>() <span class="keyword">const</span>;
<a name="l00038"></a>00038 
<a name="l00039"></a>00039     <span class="keyword">virtual</span> uint8_t* <a class="code" href="classCIPPacket.html#aa7de7cf2d95024f12a0740d46bb3acec">getPayload</a>() <span class="keyword">const</span>;
<a name="l00040"></a>00040                 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classCIPPacket.html#af42394cc0de6f588c09c17309a941cbe">getPayloadLength</a>() <span class="keyword">const</span>;
<a name="l00041"></a>00041                 <span class="keyword">virtual</span> uint8_t* <a class="code" href="classCIPPacket.html#a05201c125890fe2d9a04a6cbdf50f717">getPacketBuffer</a>() <span class="keyword">const</span>;
<a name="l00042"></a>00042 
<a name="l00043"></a>00043                 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCIPPacket.html#a8acaa57ad4dfec1b1e12e8e00aa29312">calcChecksum</a>();
<a name="l00044"></a>00044 
<a name="l00045"></a>00045         <span class="keyword">private</span>:
<a name="l00046"></a>00046                 <a class="code" href="classCIPPacket.html#abe53f8cc6295f94849299556375599cc">CIPPacket</a>();
<a name="l00047"></a>00047                 <a class="code" href="classCIPPacket.html#abe53f8cc6295f94849299556375599cc">CIPPacket</a>(uint8_t* pForeignPacketBuffer, <span class="keywordtype">int</span> pBufferLength);
<a name="l00048"></a>00048                 <a class="code" href="classCIPPacket.html#abe53f8cc6295f94849299556375599cc">CIPPacket</a>(<span class="keyword">const</span> <a class="code" href="classCIPPacket.html">CIPPacket</a>&amp; );
<a name="l00049"></a>00049                 <a class="code" href="classCIPPacket.html">CIPPacket</a>&amp; <a class="code" href="classCIPPacket.html#ad759dea0104079b8643d568f1c771eb3">operator=</a>(<span class="keyword">const</span> <a class="code" href="classCIPPacket.html">CIPPacket</a>&amp; );
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="classCIPPacket.html#aa251e5cd268ed6af42939c67b5f08c68">00051</a>                 uint8_t* <a class="code" href="classCIPPacket.html#aa251e5cd268ed6af42939c67b5f08c68">mPacketBuffer</a>;
<a name="l00052"></a><a class="code" href="classCIPPacket.html#a0eb3e5f6044bf53ea84a79aa878b2af7">00052</a>                 <span class="keywordtype">int</span> <a class="code" href="classCIPPacket.html#a0eb3e5f6044bf53ea84a79aa878b2af7">mBufferLength</a>;
<a name="l00053"></a>00053 
<a name="l00054"></a>00054                 <span class="comment">/* networking stuff */</span>
<a name="l00055"></a><a class="code" href="classCIPPacket.html#a94bea2edda3ed016c8d65334c24983ee">00055</a>                 <span class="keyword">struct </span>iphdr* <a class="code" href="classCIPPacket.html#a94bea2edda3ed016c8d65334c24983ee">mIP_header</a>;
<a name="l00056"></a><a class="code" href="classCIPPacket.html#afe47436686a3e32c00ad53c9e7410623">00056</a>                 <span class="keyword">struct </span>udphdr* <a class="code" href="classCIPPacket.html#afe47436686a3e32c00ad53c9e7410623">mUDP_header</a>;
<a name="l00057"></a><a class="code" href="classCIPPacket.html#a07452bd23d612354129bc6268382c466">00057</a>                 <span class="keyword">struct </span>tcphdr* <a class="code" href="classCIPPacket.html#a07452bd23d612354129bc6268382c466">mTCP_header</a>;
<a name="l00058"></a><a class="code" href="classCIPPacket.html#af25fdd726e44d787cd8ee2f2d88561ee">00058</a>                 uint8_t* <a class="code" href="classCIPPacket.html#af25fdd726e44d787cd8ee2f2d88561ee">mPayload</a>;
<a name="l00059"></a>00059 
<a name="l00060"></a>00060                 <span class="comment">/* helper functions */</span>
<a name="l00061"></a>00061 };
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 <span class="preprocessor">#endif </span><span class="comment">/* __IP_PACKETH_H__ */</span>
<a name="l00064"></a>00064 
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 25 2012 22:00:39 for Whisper by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
